package com.kevin.action.show;

import javax.servlet.http.HttpServletRequest;

import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.View;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.view.JspView;

import com.kevin.service.ArticleInfoService;


/**
 * 
  * @ClassName: ArticleInfoShowAction 
  * @Description: 前台文章模块
  * @author 吕凯
  * @date 2012-10-29 上午10:18:33 
  *
 */
@IocBean
@At("/articleinfos")
public class ArticleInfoShowAction{
	@Inject
	protected ArticleInfoService articleInfoService;
	
	/**
	 * 获取文章列表
	 * 
	 * @return
	 */
	@At
	public View showArticleInfoList(@Param("type")int type,@Param("p")int currentPage,HttpServletRequest request) {
		if(currentPage == 0)
			currentPage = 1;
		
		articleInfoService.getArticleInfoList(type, currentPage,10,request,Cnd.orderBy().desc("addDate"));
		//后台
		return new JspView("/jsp/show/articleinfo/showArticleInfoList");
	}
	/**
	 * 获取文章信息
	 * 
	 * @return
	 */
	@At
	@Ok("jsp:/jsp/articleinfo/showArticleInfo")
	public View showArticleInfo(@Param("id")int id,HttpServletRequest request) {
		articleInfoService.getArticleInfo(id, request);
		return new JspView("/jsp/show/articleinfo/showArticleInfo");
	}
	/**
	 * 添加文章
	 * 
	 * @return
	 */
	@At
	@Ok("jsp:/jsp/back/articleinfo/addArticleInfoList")
	public void addArticleInfo(HttpServletRequest request) {		
	}
}
